<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"  %>
<%@taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>代理商管理系统</title>
    <link rel="stylesheet" href="${ctx }/static/layui/css/layui.css">
    <script src="${ctx }/static/js/jquery.js"></script>
    <style>

        #div1 {
            width: 1600px;
            height: 105px;
            opacity:0.7;
            background-image: url("${ctx}/static/images/u1.png");
	
        }
         #div2 {
         	position:absolute;
         	top:0px;
         	right:0px;
            margin-right:0px;

        }
        h1{
            margin: 0 auto;
            padding-top: 30px;
            padding-left: 200px;
            font:'幼圆';
        }
        #ff{
            -webkit-transform: scaleY(-1);
            -moz-transform: scaleY(-1);
            -ms-transform: scaleY(-1);
            -o-transform: scaleY(-1);
            transform: scaleY(-1);
            opacity:0.5;
        }
        
/*         关键词申请 */
		.custDiv{
			width:510px;border: 1px solid;
			position:absolute;left: 130px;z-index: 2;
			background-color: white;
			display: none;
		}
		.keyWord{
			border: 1px solid;margin-top: 20px;
		}
		.keyWord form{
			margin-top: 20px;
		}
		.keyWord .layui-input,input[name=search]{
			width:500px;
			height:30px;
			display: inline-block;
		}
		
		
		#custlist{
		
			float:left;border:1px solid;width:100px;height:50px;
			cursor:pointer;
		}
		.keywordBtn{
			margin-left:20px;
			margin-bottom:20px;
		}
/* 		关键词管理 */
		 .layui-input,input[name=keywordName]{
			width:200px;
			height:30px;
			display: inline-block;
		}
		#keyWordList{
			margin-left:50px;
		}
		input[name=key]{
			width:60px;
			height:30px;
			background-image: url(../static/images/search.png);
		}
    </style>
</head>
<body>

	<div>
	    <div id="div1">
		    <h1>代理商管理系统</h1><h1 id="ff">代理商管理系统</h1>
		    <div id="div2">欢迎您：${user.loginName} <a href="#" onclick="changed()">修改密码</a> <a href="${ctx }/user/logout">退出</a></div>
	     	<input id ="agent1"  type="hidden" value="${user.loginName}">
	    </div>
	    <div class="layui-tab" style="margin: 0">
	            <ul class="layui-tab-title" style="background-color: #0C87B8">
	            <li class="layui-this">代理商管理</li>
	            <li>门户管理</li>
	            <li>报表管理</li>
	            <li>系统管理</li>
	            <li>系统配置管理</li>
	        </ul>
	        <div class="layui-tab-content">
	            <div class="layui-tab-item layui-show">
	            
	
	                    <a href="#" onclick="keyWord()">关键词申请|</a>
	                    <a href="${ctx }/custom/likeSearch?companyName=&agent=${user.loginName}" >代理商客户管理|</a>
	                    <a href="#">代理商预付款|</a>
	                    <a href="${ctx }/keyWord/likeSearch?keyWord=">关键词申请管理|</a>
	                    <a href="#">操作日志</a>
	
	            </div>
	            <div class="layui-tab-item">
	                <a href="#">门户管理</a>
	            </div>
	            <div class="layui-tab-item">
	                <a href="#">报表管理</a>
	
	            </div>
	            <div class="layui-tab-item">
	                <a href="#">财务管理|</a>
	                <a href="#">角色管理|</a>
	                <a href="#">角色权限配置|</a>
	                <a href="#">用户管理|</a>
	                <a href="#">关键词审核</a>
	            </div>
	
	            <div class="layui-tab-item">
	                <a href="#">财务类型|</a>
	                <a href="#">服务类型|</a>
	                <a href="#">服务年限|</a>
	                <a href="#">APP地址|</a>
	                <a href="#">客户类型|</a>
	                <a href="#">证件类型|</a>
	                <a href="#">优惠类型</a>
	            </div>
	        </div>
	    </div>
	    <div id="changeDiv">
	    
			<div class="layui-form-item">
	    		<label class="layui-form-label">关键词：</label>
	    		<div class="layui-input-block">
	    				
	      			<input type="text" name="keywordName" value="${searchName }" class="layui-input">
	   			 	<input type="button" name="key">
	   			 </div>
	  		</div>
	  		<h3 style="color: red">${msg }</h3>   
	  		<c:if test="${empty msg }">
	  		
		  		<table border="1" cellspacing="0" height="400px" width="80%" >
			  		<thead>
			  			<tr style="background-color: gray" >
			  				<td>序号</td>
				  			<td>关键词</td>
				  			<td>客户名称</td>
				  			<td>代理商</td>
				  			<td>申请年限</td>
				  			<td>申请日期</td>
				  			<td>到期日期</td>
				  			<td>申请到期状态</td>
				  			<td>审核状态</td>
				  			<td>使用状态</td>
				  			<td>app开通状态</td>
				  			<td>操作</td>
			  			</tr>
			  		</thead>
			  		<tbody>
			  			<c:forEach items="${kd.list }" var="obj" varStatus="i">
			  				
			  				<tr>
			  					<td>${i.index+1}</td>
					  			<td>${obj.keywordName }</td>
					  			<td>${obj.customName }</td>
					  			<td>${obj.user.loginName }</td>
					  			<td>${obj.year }</td>
					  			<td><fmt:formatDate value="${obj.startDate }"/></td>
					  			<td><fmt:formatDate value="${obj.endDate }"/></td>
					  			<td>${obj.applyState }</td>
					  			<td>${obj.auditState }</td>
					  			<td>${obj.useState }</td>
					  			<td>${obj.appState }</td>
					  			
					  			<c:if test="${obj.auditState eq '已审核' }">
					  				<c:if test="${obj.appState eq '已开通' }">
					  					<td><a href="#" style="color: blue">续费</a></td>
					  				</c:if>
					  				<c:if test="${obj.appState ne '已开通' }">
					  					<td><a href="#" style="color: blue">开通app</a> <a href="#" style="color: blue">续费</a></td>
					  				</c:if>
		
					  			</c:if>
					  			<c:if test="${obj.auditState ne '已审核' }">
					  				<td>无操作</td>
					  			</c:if>
			  				</tr>	
			  				
			  			</c:forEach>
						
			  		</tbody>
			  	</table>
	  			<div style="margin-left: 550px;color: blue">
			  		<a style="color: blue" href="javascript:;" id="firstPage">首页</a>|
					<a style="color: blue" href="javascript:;" id="prevPage">《上一页</a>|
					<a style="color: blue" href="javascript:;" id="nextPage">下一页》</a>|
					<a style="color: blue" href="javascript:;" id="lastPage">尾页</a>
				</div>
	  		</c:if>
	    </div>
	</div>
	
	<form action="${ctx }/keyWord/page" id="hiddenForm" method="post">
		<input type="hidden" name="pageNum"><br>
		<input type="hidden" name="pageSize" value="8"><br>
		<input type="hidden" name="word"><br>
	</form>
	
</body>
<script src="${ctx }/static/layui/layui.all.js"></script>
<script>
	function changed(){
		$("#changeDiv").load("${ctx}/pages/changePassword.jsp");
	}
		
	function keyWord(){
		$("#changeDiv").load("${ctx}/pages/keyWord.jsp");
	
	}
	
	//分页
	$('#firstPage').click(function(){
		// 1更新当前页码
		var pageNum = 1;
		// 3填写的值
		var keywordName = $('input[name=keywordName]').val();
		$('input[name=pageNum]').val(pageNum);
		$('input[name=word]').val(keywordName);
		$('form#hiddenForm').submit();
	})
	
	$('#prevPage').click(function(){
		// 1更新当前页码
		var pageNum = '${kd.pageNum-1}';
		// 2获取选择查询的类型
		
		var keywordName = $('input[name=keywordName]').val();
		$('input[name=pageNum]').val(pageNum);
		$('input[name=word]').val(keywordName);
		$('form#hiddenForm').submit();
	})
	
	$('#nextPage').click(function(){
		// 1更新当前页码
		var pageNum = '${kd.pageNum+1}';
		// 2获取选择查询的类型
		var keywordName = $('input[name=keywordName]').val();
		$('input[name=pageNum]').val(pageNum);
		$('input[name=word]').val(keywordName);
		$('form#hiddenForm').submit();
	})
	
	$('#lastPage').click(function(){
		// 1更新当前页码
		var pageNum = '${kd.pages}';
		// 2获取选择查询的类型
		var keywordName = $('input[name=keywordName]').val();
		$('input[name=pageNum]').val(pageNum);
		$('input[name=word]').val(keywordName);
		$('form#hiddenForm').submit();
	})
	
	$("input[name=key]").click(function(){
		
		var keywordName = $('input[name=keywordName]').val();
	
		
		window.location= "${ctx }/keyWord/likeSearch?keyWord="+keywordName;
	})
</script>
</html>

























